<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('message', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->default(0)->comment('接收用户id 非0则为指定用户');
            $table->string('msg_title',100)->default('')->comment('消息标题');
            $table->text('msg_content')->default('')->comment('消息内容');
            $table->dateTime('msg_time')->comment('消息发送时间');
            $table->tinyInteger('msg_type')->default(0)->comment('消息类型0为系统消息 1为指定用户消息 2为管理员消息');
            $table->tinyInteger('msg_status')->default(1)->comment('状态1为正常，0为已删除 ');
            $table->index('msg_status');
            $table->index('msg_type');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('message');
    }
}
